#ifndef _CHANNEL_MANAGER_H
#define _CHANNEL_MANAGER_H

#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <Channel.h>
#include <map>
#include <malloc_align.h>

#include <csp_shared_types.h>

#define MAX_CHANNELS 700


using namespace std;


class ChannelManager
{
	public:
		~ChannelManager();
		Channel* GetChannel(long type, long id);
		static ChannelManager* Instance();
	protected:
		ChannelManager();
		ChannelManager(const ChannelManager&);
		ChannelManager& operator= (const ChannelManager&);
	private:
		static ChannelManager* pinstance;
		//map <long, Channel*> one2one;
		//map <long, Channel*> any2one;
		//map <long, Channel*> any2any;
		//map <long, Channel*> one2any;
		Channel *channel_db[MAX_CHANNELS];
		pthread_mutex_t chan_man_lock;
};

#endif
